import React from 'react';
import { View, Text, ActivityIndicator, StyleSheet } from 'react-native';
import { CommonStyle } from '../common/commonStyle.ts';

interface ILoadingIndicatorProps {
  size?: 'small' | 'large';
  color?: string;
  text?: string;
}
const LoadingIndicator: React.FC<ILoadingIndicatorProps> = ({ text, size = 'large', color = CommonStyle.mainColor }) => {
  return (
    <View style={[styles.container]}>
      <ActivityIndicator color={color} />
      {text && <Text style={styles.text}>{text}</Text>}
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    justifyContent: 'center',
    alignItems: 'center',
    marginBottom: 40,
  },
  text: {
    marginTop: 10,
    fontSize: 12,
    color: '#333',
  },
});

export default LoadingIndicator;
